using Mono.Boost.Graph;
using System.Collections.Generic;
using NUnit.Framework;
[TestFixture]
public class TestComponents
{
    [Test]
    public void Specialized()
    {
        Pair<uint,uint>[] tab = new Pair<uint,uint>[]{new Pair<uint,uint>(0,1),new Pair<uint,uint>(1,2),new Pair<uint,uint>(2,3),new Pair<uint,uint>(3,4),new Pair<uint,uint>(4,5),new Pair<uint,uint>(3,6),new Pair<uint,uint>(2,5),new Pair<uint,uint>(7,8),new Pair<uint,uint>(8,9),new Pair<uint,uint>(9,7)};

        StaticGraph g = new StaticGraph(10,tab);
        StaticPropertyMap<uint> lay = new StaticPropertyMap<uint>(10);
        StaticPropertyMap<uint> component = new StaticPropertyMap<uint>(10);

        Bfs.calculate_layers(g,lay,0);
        ConnectedComponents.strongly_connected_components< StaticPropertyMap<uint> >(g, component);


        foreach(uint v in g.vertices)
            System.Console.WriteLine("Vertex {0}, layer {1}, component {2}",v,lay.get(v),component.get(v));
    }

    [Test]
    public void Generic()
    {
        Pair<uint, uint>[] tab = new Pair<uint, uint>[] { new Pair<uint, uint>(0, 1), new Pair<uint, uint>(1, 2), new Pair<uint, uint>(2, 3), new Pair<uint, uint>(3, 4), new Pair<uint, uint>(4, 5), new Pair<uint, uint>(3, 6), new Pair<uint, uint>(2, 5), new Pair<uint, uint>(7, 8), new Pair<uint, uint>(8, 9), new Pair<uint, uint>(9, 7) };

        StaticGraph g = new StaticGraph(10, tab);
        StaticPropertyMap<uint> lay = new StaticPropertyMap<uint>(10);
        StaticPropertyMap<uint> component = new StaticPropertyMap<uint>(10);

        Bfs.calculate_layers(g, lay, 0);
        ConnectedComponents.strongly_connected_components< StaticGraph, StaticPropertyMap<uint> >(g, component);


        foreach (uint v in g.vertices)
            System.Console.WriteLine("Vertex {0}, layer {1}, component {2}", v, lay.get(v), component.get(v));
    }
}
